package com.caine.tc.server.initializer;

import com.caine.tc.server.handler.ChildChannelHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

/**
 * @Author: CaineZhu
 * @Description:
 * @Date: Created in 12:39 2020/11/24
 * @Modified By:
 */
public class CaineChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast("decoder",new StringDecoder())
                .addLast("encoder", new StringEncoder())
                .addLast("handler", new ChildChannelHandler());
    }
}
